var member = null;


//写cookies，一个小时过期 
function setCookie(name, value) {
	var exp = new Date();
	exp.setTime(exp.getTime() + 60 * 60 * 1000);
	document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() + ";path=/";
}

//读取cookies 
function getCookie(name) {
	var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");

	if(arr = document.cookie.match(reg))

		return unescape(arr[2]);
	else
		return null;
}

//删除cookies 
function delCookie(name) {
	var exp = new Date();
	exp.setTime(exp.getTime() - 60 * 60 * 1000);
	var cval = getCookie(name);
	if(cval != null)
		document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ";path=/";
}

//写
function setObj(name, value) {
	if(!window.localStorage){
        alert("不支持localstorage");
        return;
    }
  	var storage=window.localStorage;
    storage[name]=JSON.stringify(value);
}

//读取
function getObj(name) {
	if(!window.localStorage){
        alert("不支持localstorage");
        return;
    }
	var storage=window.localStorage;
	try{
		return JSON.parse(storage[name]);	
	}catch(e){
		return null;
	}
	
	var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
}
